﻿<%@ Page Language="C#" MasterPageFile="~/GoWLL.master" AutoEventWireup="true" CodeFile="Editfaq.aspx.cs" Inherits="Editfaq" Title="编辑FAQ列表" validateRequest="false"%>
<%@ Register tagprefix="tinymce" Namespace="Moxiecode.TinyMCE.Web" Assembly="Moxiecode.TinyMCE" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceMenu" Runat="Server">
    <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource2">
        <ItemTemplate>
           <a href="#"><%#Eval ("Title") %></a>
        </ItemTemplate>
    </asp:Repeater>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:GoWLLConnectionString %>" 
        SelectCommand="SELECT * FROM [GowllFaq]" >

    </asp:SqlDataSource>    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceMainText" Runat="Server">

<div id="contenttext">

<form runat="server">

    <asp:FormView ID="FormView1" runat="server" DataKeyNames="ID" 
        DataSourceID="SqlDataSource1" AllowPaging="True">
        <PagerSettings Mode="NumericFirstLast" PageButtonCount="15" />
        <EditItemTemplate>
            <div class="panel" align="justify">
		    <span class="orangetitle">
                <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' Width="200"/>
            </span>
            <tinymce:TextArea id="elm1" theme="advanced" runat="server" Value='<%# Bind("content") %>' Width="500" Rows="20" Font-Size="Large" />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                CommandName="Update" Text="更新" />
            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="取消" />        
             </div>
        </EditItemTemplate>
        <InsertItemTemplate>
            <div class="panel" align="justify">
                   <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' Width="200" />
                    <br />
                    <tinymce:TextArea id="elm2" theme="simpled" runat="server" Value='<%# Bind("content") %>' Width="500" Rows="15" Font-Size="Large" />
             
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="插入" />
                    &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="取消" />
                </div>
        </InsertItemTemplate>
        <ItemTemplate>
            <div class="panel" align="justify">
            <span class="orangetitle">            
                问：<asp:Label ID="TitleLabel" runat="server" Text='<%# Bind("Title") %>' />
            <br />
            </span>
            
            <span class="bodytext"><br /><br />
                <asp:Label ID="contentLabel" runat="server" Text='<%# Bind("content") %>' />
            <br />
            </span>
            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                CommandName="Edit" Text="编辑" />
            &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                CommandName="Delete" Text="删除" />
            &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="新建" />
            </div>
        </ItemTemplate>
    </asp:FormView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:GoWLLConnectionString %>" 
        DeleteCommand="DELETE FROM [GowllFaq] WHERE [ID] = @ID" 
        InsertCommand="INSERT INTO [GowllFaq] ([Title], [content]) VALUES (@Title, @content)" 
        SelectCommand="SELECT * FROM [GowllFaq]" 
        UpdateCommand="UPDATE [GowllFaq] SET [Title] = @Title, [content] = @content WHERE [ID] = @ID">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="Title" Type="String" />
            <asp:Parameter Name="content" Type="String" />
            <asp:Parameter Name="ID" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="ID" Type="Int32" />
            <asp:Parameter Name="Title" Type="String" />
            <asp:Parameter Name="content" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
    
 </form>
</div>
</asp:Content>

